import dayjs from 'dayjs';
import { objKeyTransfer, MEANS } from '../utils/convention';

export interface User {
  id: number;
  openid: string;
  phone: number;
  nick_name: string;
  gender: number,
  avatar: string;
  mesh: string;
  create_time: string;
  update_time: string;
}


export function initUser(data = {}) {

  const time = dayjs().format('YYYY-MM-DD HH:mm:ss');
  return objKeyTransfer({
    create_time: time,
    update_time: time,
    ...data,
  }, MEANS.CamelToSnake);
}

export function updateUser(data = {}) {
  const time = dayjs().format('YYYY-MM-DD HH:mm:ss');
  return objKeyTransfer({
    update_time: time,
    ...data,
  }, MEANS.CamelToSnake);
}
